//## begin module%3B880274022E.cm preserve=no
//	  %X% %Q% %Z% %W%
//## end module%3B880274022E.cm

//## begin module%3B880274022E.cp preserve=no
//	+----------------------------------------------+
//	| SVMBR - A program for training SVMs          |
//	+----------------------------------------------+
//	| * Creator, modeling, coding:                 |
//	|    Marcelo Barros de Almeida                 |
//	|    barros@smar.com.br                        |
//	|    http://litc.cpdee.ufmg.br/~barros/        |
//	| * Coding, improvements, bug fixes:           |
//	|    Bernardo Penna                            |
//	|    bprc@brfree.com.br                        |
//	+----------------------------------------------+
//
//	 Copyright(c) 2002 by Marcelo Barros de Almeida
//	                            All rights reserved
//
//	-[CVS]------------------------------------------
//	$Author$
//	$Date$
//	$Source$
//	$Name$
//	$Revision$
//	------------------------------------------------
//## end module%3B880274022E.cp

//## Module: svm%3B880274022E; Package specification
//## Subsystem: <Top Level>
//## Source file: D:\textotese\svmbr\src\svm.h

#ifndef svm_h
#define svm_h 1

//## begin module%3B880274022E.additionalIncludes preserve=no
//## end module%3B880274022E.additionalIncludes

//## begin module%3B880274022E.includes preserve=yes
//## end module%3B880274022E.includes

// data
#include "data.h"
// solver
#include "solver.h"
// kernel
#include "kernel.h"
// global
#include "global.h"
//## begin module%3B880274022E.declarations preserve=no
//## end module%3B880274022E.declarations

//## begin module%3B880274022E.additionalDeclarations preserve=yes
//## end module%3B880274022E.additionalDeclarations


//## begin SVM%3B87FDC30029.preface preserve=yes
//## end SVM%3B87FDC30029.preface

//## Class: SVM%3B87FDC30029
//## Category: SVM package%3B880585029B
//## Subsystem: <Top Level>
//## Persistence: Transient
//## Cardinality/Multiplicity: n

class SVM 
{
  //## begin SVM%3B87FDC30029.initialDeclarations preserve=yes
  //## end SVM%3B87FDC30029.initialDeclarations

  public:

    //## Other Operations (specified)
      //## Operation: printSummary%998688354
      virtual VOID printSummary () = 0;

      //## Operation: saveResult%998688355
      virtual INT saveResult () = 0;

      //## Operation: calcNorm%998688357
      //	This function returns |w|^2.
      //	The distance between hiperplane and margins is given
      //	by 1/|w|.
      REAL calcNorm ();

      //## Operation: setData%998688378
      VOID setData (Data *datap);

      //## Operation: setSolver%998688379
      VOID setSolver (Solver *solverp);

      //## Operation: setKernel%998880761
      VOID setKernel (Kernel *kernelp);

      //## Operation: setsvmFile%998880768
      VOID setsvmFile (CHAR *svmf);

      //## Operation: run%998688380
      virtual INT run () = 0;

      //## Operation: getnorm%999139401
      REAL getnorm () const;

      //## Operation: evalOutput%999139407
      virtual REAL evalOutput (UINT i1) = 0;

      //## Operation: getData%1000755795
      Data * getData ();

    // Data Members for Class Attributes

      //## Attribute: HARD_LIMIT%3B8A3AF40238
      //## begin SVM::HARD_LIMIT%3B8A3AF40238.attr preserve=no  public: static SHORT {V} 1
      static SHORT HARD_LIMIT;
      //## end SVM::HARD_LIMIT%3B8A3AF40238.attr

      //## Attribute: SOFT_LIMIT%3B8A3B02009D
      //## begin SVM::SOFT_LIMIT%3B8A3B02009D.attr preserve=no  public: static SHORT {V} 0
      static SHORT SOFT_LIMIT;
      //## end SVM::SOFT_LIMIT%3B8A3B02009D.attr

      //## Attribute: SVMBR_VERSION%3B8B95D20234
      //## begin SVM::SVMBR_VERSION%3B8B95D20234.attr preserve=no  public: static CHAR * {UA} "2.0.1"
      static const CHAR *SVMBR_VERSION;
      //## end SVM::SVMBR_VERSION%3B8B95D20234.attr

    // Additional Public Declarations
      //## begin SVM%3B87FDC30029.public preserve=yes
      //## end SVM%3B87FDC30029.public

  protected:
    // Data Members for Class Attributes

      //## Attribute: svmFile%3B8A4E130146
      //## begin SVM::svmFile%3B8A4E130146.attr preserve=no  protected: CHAR [_MAX_PATH] {UA} 
      CHAR  svmFile[_MAX_PATH];
      //## end SVM::svmFile%3B8A4E130146.attr

      //## Attribute: norm%3B8E56D303D4
      //## begin SVM::norm%3B8E56D303D4.attr preserve=no  protected: REAL {UA} 
      REAL norm;
      //## end SVM::norm%3B8E56D303D4.attr

      //## Attribute: bias%3B8E6BAE024B
      //## begin SVM::bias%3B8E6BAE024B.attr preserve=no  protected: REAL {UA} 
      REAL bias;
      //## end SVM::bias%3B8E6BAE024B.attr

      //## Attribute: alpha%3B8E6BB6024C
      //## begin SVM::alpha%3B8E6BB6024C.attr preserve=no  protected: REAL * {UA} 
      REAL *alpha;
      //## end SVM::alpha%3B8E6BB6024C.attr

      //## Attribute: numSV%3B8E6C650334
      //## begin SVM::numSV%3B8E6C650334.attr preserve=no  protected: INT {UA} 
      INT numSV;
      //## end SVM::numSV%3B8E6C650334.attr

      //## Attribute: dim%3B8E70380224
      //## begin SVM::dim%3B8E70380224.attr preserve=no  protected: INT {UA} 
      INT dim;
      //## end SVM::dim%3B8E70380224.attr

      //## Attribute: supVec%3B8EAF6C00CB
      //## begin SVM::supVec%3B8EAF6C00CB.attr preserve=no  protected: REAL ** {UA} 
      REAL **supVec;
      //## end SVM::supVec%3B8EAF6C00CB.attr

      //## Attribute: supVecTarget%3B8EB0A900F9
      //## begin SVM::supVecTarget%3B8EB0A900F9.attr preserve=no  protected: REAL * {UA} 
      REAL *supVecTarget;
      //## end SVM::supVecTarget%3B8EB0A900F9.attr

      //## Attribute: crono%3BA9FD35001D
      //## begin SVM::crono%3BA9FD35001D.attr preserve=no  protected: Cronometer {UA} 
      Cronometer crono;
      //## end SVM::crono%3BA9FD35001D.attr

    // Data Members for Associations

      //## Association: SVM package::<unnamed>%3B88176202AB
      //## Role: SVM::kernel%3B8817640312
      //## begin SVM::kernel%3B8817640312.role preserve=no  protected: Kernel { -> RHGAN}
      Kernel *kernel;
      //## end SVM::kernel%3B8817640312.role

      //## Association: SVM package::<unnamed>%3B8817C200C8
      //## Role: SVM::data%3B8817C300D4
      //## begin SVM::data%3B8817C300D4.role preserve=no  protected: Data { -> RHGAN}
      Data *data;
      //## end SVM::data%3B8817C300D4.role

      //## Association: SVM package::<unnamed>%3B88115D0024
      //## Role: SVM::solver%3B88115E0044
      //## begin SVM::solver%3B88115E0044.role preserve=no  protected: Solver { -> RHGAN}
      Solver *solver;
      //## end SVM::solver%3B88115E0044.role

    // Additional Protected Declarations
      //## begin SVM%3B87FDC30029.protected preserve=yes
      //## end SVM%3B87FDC30029.protected

  private:
    // Additional Private Declarations
      //## begin SVM%3B87FDC30029.private preserve=yes
      //## end SVM%3B87FDC30029.private

  private: //## implementation
    // Additional Implementation Declarations
      //## begin SVM%3B87FDC30029.implementation preserve=yes
      //## end SVM%3B87FDC30029.implementation

};

//## begin SVM%3B87FDC30029.postscript preserve=yes
//## end SVM%3B87FDC30029.postscript

//## begin TrainSVM%3B87FDD10246.preface preserve=yes
//## end TrainSVM%3B87FDD10246.preface

//## Class: TrainSVM%3B87FDD10246
//## Category: SVM package%3B880585029B
//## Subsystem: <Top Level>
//## Persistence: Transient
//## Cardinality/Multiplicity: n

class TrainSVM : public SVM  //## Inherits: <unnamed>%3B87FDE90254
{
  //## begin TrainSVM%3B87FDD10246.initialDeclarations preserve=yes
  //## end TrainSVM%3B87FDD10246.initialDeclarations

  public:
    //## Destructor (generated)
      ~TrainSVM();


    //## Other Operations (specified)
      //## Operation: run%998688382
      INT run ();

      //## Operation: printSummary%998688383
      VOID printSummary ();

      //## Operation: saveResult%998880794
      INT saveResult ();

      //## Operation: evalOutput%999139422
      REAL evalOutput (UINT i1);

    // Additional Public Declarations
      //## begin TrainSVM%3B87FDD10246.public preserve=yes
      //## end TrainSVM%3B87FDD10246.public

  protected:
    // Additional Protected Declarations
      //## begin TrainSVM%3B87FDD10246.protected preserve=yes
      //## end TrainSVM%3B87FDD10246.protected

  private:
    // Additional Private Declarations
      //## begin TrainSVM%3B87FDD10246.private preserve=yes
      //## end TrainSVM%3B87FDD10246.private

  private: //## implementation
    // Additional Implementation Declarations
      //## begin TrainSVM%3B87FDD10246.implementation preserve=yes
      //## end TrainSVM%3B87FDD10246.implementation

};

//## begin TrainSVM%3B87FDD10246.postscript preserve=yes
//## end TrainSVM%3B87FDD10246.postscript

//## begin TestSVM%3B87FDD9007B.preface preserve=yes
//## end TestSVM%3B87FDD9007B.preface

//## Class: TestSVM%3B87FDD9007B
//## Category: SVM package%3B880585029B
//## Subsystem: <Top Level>
//## Persistence: Transient
//## Cardinality/Multiplicity: n

class TestSVM : public SVM  //## Inherits: <unnamed>%3B87FDED0282
{
  //## begin TestSVM%3B87FDD9007B.initialDeclarations preserve=yes
  //## end TestSVM%3B87FDD9007B.initialDeclarations

  public:
    //## Constructors (specified)
      //## Operation: TestSVM%999139404
      TestSVM (CHAR *svmf, CHAR *trainf, CHAR *outf, SHORT limi);

    //## Destructor (generated)
      ~TestSVM();


    //## Other Operations (specified)
      //## Operation: run%998688384
      INT run ();

      //## Operation: printSummary%998688385
      VOID printSummary ();

      //## Operation: saveResult%998880795
      INT saveResult ();

      //## Operation: loadSVM%999139402
      INT loadSVM ();

      //## Operation: loadSVM%999139403
      INT loadSVM (CHAR *filen);

      //## Operation: evalAllOutputs%999139406
      VOID evalAllOutputs ();

      //## Operation: evalOutput%999139408
      REAL evalOutput (UINT i1);

      //## Operation: getevalTarget%1000303070
      REAL getevalTarget (INT i1) const;

    // Additional Public Declarations
      //## begin TestSVM%3B87FDD9007B.public preserve=yes
      //## end TestSVM%3B87FDD9007B.public

  protected:
    // Additional Protected Declarations
      //## begin TestSVM%3B87FDD9007B.protected preserve=yes
      //## end TestSVM%3B87FDD9007B.protected

  private:
    // Additional Private Declarations
      //## begin TestSVM%3B87FDD9007B.private preserve=yes
      //## end TestSVM%3B87FDD9007B.private

  private: //## implementation
    // Data Members for Class Attributes

      //## Attribute: trainPattFile%3B8E6E3B002D
      //## begin TestSVM::trainPattFile%3B8E6E3B002D.attr preserve=no  private: CHAR [_MAX_PATH] {U} 
      CHAR  trainPattFile[_MAX_PATH];
      //## end TestSVM::trainPattFile%3B8E6E3B002D.attr

      //## Attribute: outFile%3B8E6E44038D
      //## begin TestSVM::outFile%3B8E6E44038D.attr preserve=no  private: CHAR [_MAX_PATH] {U} 
      CHAR  outFile[_MAX_PATH];
      //## end TestSVM::outFile%3B8E6E44038D.attr

      //## Attribute: evalTarget%3B8E9B24031E
      //## begin TestSVM::evalTarget%3B8E9B24031E.attr preserve=no  private: REAL * {U} 
      REAL *evalTarget;
      //## end TestSVM::evalTarget%3B8E9B24031E.attr

      //## Attribute: mse%3B8E9C3303E6
      //## begin TestSVM::mse%3B8E9C3303E6.attr preserve=no  private: REAL {U} 
      REAL mse;
      //## end TestSVM::mse%3B8E9C3303E6.attr

      //## Attribute: numCorrect%3B8E9C3701A7
      //## begin TestSVM::numCorrect%3B8E9C3701A7.attr preserve=no  private: INT {U} 
      INT numCorrect;
      //## end TestSVM::numCorrect%3B8E9C3701A7.attr

      //## Attribute: limits%3B8E9CC20233
      //## begin TestSVM::limits%3B8E9CC20233.attr preserve=no  private: SHORT {U} 
      SHORT limits;
      //## end TestSVM::limits%3B8E9CC20233.attr

    // Additional Implementation Declarations
      //## begin TestSVM%3B87FDD9007B.implementation preserve=yes
      //## end TestSVM%3B87FDD9007B.implementation

};

//## begin TestSVM%3B87FDD9007B.postscript preserve=yes
//## end TestSVM%3B87FDD9007B.postscript

// Class SVM 


//## Other Operations (inline)
inline VOID SVM::setData (Data *datap)
{
  //## begin SVM::setData%998688378.body preserve=yes
	data = datap;
  //## end SVM::setData%998688378.body
}

inline VOID SVM::setSolver (Solver *solverp)
{
  //## begin SVM::setSolver%998688379.body preserve=yes
	solver = solverp;
  //## end SVM::setSolver%998688379.body
}

inline VOID SVM::setKernel (Kernel *kernelp)
{
  //## begin SVM::setKernel%998880761.body preserve=yes
	kernel = kernelp;
  //## end SVM::setKernel%998880761.body
}

inline REAL SVM::getnorm () const
{
  //## begin SVM::getnorm%999139401.body preserve=yes
	return norm;
  //## end SVM::getnorm%999139401.body
}

// Class TrainSVM 

// Class TestSVM 


//## Other Operations (inline)
inline REAL TestSVM::getevalTarget (INT i1) const
{
  //## begin TestSVM::getevalTarget%1000303070.body preserve=yes
	return evalTarget[i1];
  //## end TestSVM::getevalTarget%1000303070.body
}

//## begin module%3B880274022E.epilog preserve=yes
//## end module%3B880274022E.epilog


#endif
